<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j">
<head>
<title>#{bundle.painelturma}</title>
</head>
<body>
	<div id="accordion3">
		<rich:simpleTogglePanel label="#{bundle.painelcadturma}" switchType="client">
			<div>
				<div>
					<h:form>
				#{bundle.painelnumero}<br />
						<h:inputText required="true" id="numero" value="#{pTurmaBean.numero}">
							<f:validateLongRange minimum="1" />
							<f:validator validatorId="chaveValidator" />
							<f:attribute name="tipo" value="Turma" />							
						</h:inputText>
						<h:message for="numero" style="color: blue;font-weight: bold;margin-left: 10px;" />
						<br />
				#{bundle.painelcap}<br />
						<h:inputText required="true" id="cap" value="#{pTurmaBean.capacidade}">
							<f:validateLongRange minimum="1" />							
						</h:inputText>
						<h:message for="cap" style="color: blue;font-weight: bold;margin-left: 10px;" />
						<br />
				#{bundle.painelturno}<br />
						<h:selectOneMenu id="turno" value="#{pTurmaBean.turno}">
							<f:selectItem itemLabel="Manhã" itemValue="Manhã" />
							<f:selectItem itemLabel="Tarde" itemValue="Tarde" />
							<f:selectItem itemLabel="Noite" itemValue="Noite" />
						</h:selectOneMenu>
						<br />
				#{bundle.painelinicio}<br />
						<rich:calendar value="#{pTurmaBean.dataInicio}" required="true" id="dataIniTur"
							datePattern="dd/MM/yyyy" enableManualInput="true" binding="#{dataI}" />
						<h:message for="dataIniTur" style="color: blue;font-weight: bold;margin-left: 10px;" />
						<br />
				#{bundle.paineltermino}<br />
						<rich:calendar value="#{pTurmaBean.dataFim}" required="true" id="dataFimTur"
							datePattern="dd/MM/yyyy" enableManualInput="true" >
							<f:validator validatorId="dataValidator" />
							<f:attribute name="dataI" value="#{dataI}" />
						</rich:calendar>
						<h:message for="dataFimTur" style="color: blue;font-weight: bold;margin-left: 10px;" />
						<br />
				#{bundle.painelnomeprof}<br />
						<h:selectOneMenu id="prof" value="#{pTurmaBean.professor}">
							<f:selectItems value="#{pTurmaBean.professores}" />
						</h:selectOneMenu>
						<br />
				#{bundle.painelnomecurso}<br />
						<h:selectOneMenu id="curso" value="#{pTurmaBean.curso}">
							<f:selectItems value="#{pTurmaBean.cursos}" />
						</h:selectOneMenu>
						<br />
						<br />
						<br />
						<h:commandButton type="submit" value="#{bundle.painelcad}"
							action="#{pTurmaBean.cadastrar}" />
					</h:form>
				</div>
			</div>
		</rich:simpleTogglePanel>
		<rich:simpleTogglePanel label="#{bundle.painelverturma}" switchType="client">
			<div>
				<div>
					<h:form>
						<h:dataTable bgcolor="#F8F8FF" cellpadding="10px" width="100%"
							var="turma" headerClass="head_listacurso" id="dtpantur"
							styleClass="table_listapainel" rowClasses="tr_listapainel"
							value="#{pTurmaBean.turmas}">
							<h:column>
								<f:facet name="header">
									<h:outputText>
										<b>#{bundle.painelnumero}</b>
									</h:outputText>
								</f:facet>
								<h:outputFormat value="#{turma.numero }" />
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText>
										<b>#{bundle.painelnomecurso}</b>
									</h:outputText>
								</f:facet>
								<h:outputFormat value="#{turma.curso.nome }" />
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText>
										<b>#{bundle.painelch}</b>
									</h:outputText>
								</f:facet>
								<h:outputFormat value="#{turma.curso.cargahoraria } hs" />
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText>
										<b>#{bundle.painelturno}</b>
									</h:outputText>
								</f:facet>
								<h:outputFormat value="#{turma.turno }" />
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText>
										<b>#{bundle.painelnomeprof}</b>
									</h:outputText>
								</f:facet>
								<h:outputFormat value="#{turma.professor.nome }" />
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText>
										<b>#{bundle.painelinicio}</b>
									</h:outputText>
								</f:facet>
								<h:outputFormat value="{0,date,dd/MM/yyyy}">
									<f:param value="#{turma.dataInicio.time}" />
								</h:outputFormat>
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText>
										<b>#{bundle.paineltermino}</b>
									</h:outputText>
								</f:facet>
								<h:outputFormat value="{0,date,dd/MM/yyyy}">
									<f:param value="#{turma.dataFim.time}" />
								</h:outputFormat>
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText>#{bundle.painelacoes}</h:outputText>
								</f:facet>
								<a4j:commandButton action="#{eTurmaBean.carregar}" value="#{bundle.paineleditar}" id="atualTurma"
									 oncomplete="Richfaces.showModalPanel('panelTur')" 
									 reRender="numTur,turnoTur,capTur,dITur,dFTur,profTur,cursoTur,aluTur">
									<f:setPropertyActionListener value="#{turma}"
										target="#{eTurmaBean.atual}" />									
								</a4j:commandButton>
								<h:commandButton action="#{pTurmaBean.deletar}" value="#{bundle.painelexcluir}"
									onclick="return confirm('#{bundle.paineloconfirmexcluirturma}');">
									<f:setPropertyActionListener value="#{turma.numero}"
										target="#{pTurmaBean.numDel}" />
								</h:commandButton>
							</h:column>
						</h:dataTable>
					</h:form>
					<f:subview id="editturma">
						<ui:include src="/editarturma.xhtml" />
					</f:subview>
				</div>
			</div>
		</rich:simpleTogglePanel>
	</div>
</body>
</html>